/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package taskmanager2ndedition;

import java.sql.*;
import com.mysql.jdbc.Driver;
import java.util.ArrayList;
import java.util.List;

/**
 * Just for testing purpose
 * @author Pavel
 */
public class DataBaseOperations {

    static java.sql.Connection conn;
    

    private DataBaseOperations() throws Exception {
        String driver = "com.mysql.jdbc.Driver";
            String url = "jdbc:mysql://localhost:3306/";
            String dbName = "TaskManagerDatabase";
            String userName = "root";
            String password = "";
        Class.forName(driver).newInstance();
        conn = DriverManager.getConnection(url + dbName,userName,password);
    }

    public static void main(String args[]) throws Exception {
        DataBaseOperations dbo = new DataBaseOperations();
        Statement stmt = null;
        ResultSet rs = null;  
        int id = 1;
        ArrayList<User> result = new ArrayList<User>();
        try {
            stmt = conn.createStatement();
            rs = stmt.executeQuery("DELETE * FROM Users WHERE UserID = '" + "'");            
            stmt  = conn.createStatement();
        } finally {
            if (rs != null) {
                rs.close();
                for (User u : result) {
                    System.out.println(u.getLogin());
                }
            }
            if (stmt != null) {
                rs.close();
            }
        }
    }
}  
    
      